<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/layouts/taglib.jsp" %>
<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>APP配置</title>
		<%@ include file="/WEB-INF/layouts/index-header.jsp" %>
	</head>
	<body>
		<div class="tpanel">
			<div class="panel-content">
				<div class="container-fluid">
					<div id="tool">
						<form id="searchForm" class="form-inline" onsubmit="return search('#searchForm','#table')"
							  style="margin-top:20px;margin-bottom:20px;">
							<div class="form-group">
								<label class="">APP类型：</label>
								<input type="text" name="search_LIKES_appType" class="form-control" />
							</div>
							<div class="form-group">
								<label class="">配置项：</label>
								<input type="text" name="search_LIKES_name" class="form-control">
							</div>
							<div class="form-group">
								<button type="submit" class="btn btn-primary radius">
								  <span class="glyphicon glyphicon-search"></span> 查询
								</button>
								<a class="btn btn-success radius" href="${ctx}/admin/app-config/create">
									<span class="glyphicon glyphicon-cog"></span>
									创建
								</a>
<%--								<a class="btn btn-success radius" href="javascript:syncAppConfig();">--%>
<%--									从中心同步配置--%>
<%--								</a>--%>
							</div>
						</form>
					</div> 
					<table id="table"></table>
				</div>
			</div>
		</div>

		<script type="text/javascript">
            window.parent.changeTitle('APP配置');
        $(function() {
            // $('.form_datetime').datetimepicker({
            //     language : 'zh-CN',
            //     autoclose : true
            // });
            $('#table').bootstrapTable({
                url: '${ctx}/admin/app-config/list',
                idField : 'id',
                striped : true,
                uniqueId : 'id',
                /*checkbox : true,*/
                /*clickToSelect : true,*/
                queryParams : queryParams,
                responseHandler : responseHandler,
                columns: [/*{
                    field: 'ck',
                    checkbox : true
                },*/{
                    title: '#',
                    width : 50,
                    align : 'center',
                    formatter: snFormatter
				},{
					field: 'createdTime',
					title: '创建时间',
					align : 'center'
				}, {
					field: 'appType',
					title: 'APP类型',
					align : 'center'
				},{
                    field: 'name',
                    title: '配置项',
                    align : 'center'
                }, {
                    field: 'value',
					width: 500,
                    title: '配置值',
                    align : 'center'
                }, {
					field: 'op',
					title: '操作',
					align: 'center',
					formatter: operateFormatter
				}]
            });

        });

        function operateFormatter(value, row, index) {
			//  = '<a title="查看详情" href="javascript:detail(' + row.id + ')"><i class="iconfont icon-caidanguanli"></i></a>';
			// content += '&nbsp;&nbsp;&nbsp;&nbsp;';
			var content = '<a href="${ctx}/admin/app-config/update?id=' + row.id + '" title="编辑"><i class="iconfont icon-iconfontcolor32"></i></a>';
			content += '&nbsp;&nbsp;&nbsp;&nbsp;';
			content += '<a href="javascript:del(' + row.id + ')" title="删除"><i class="iconfont icon-shanchu"></i></a>';
			return content;
        }

        function del(id) {
			carefulDelete('${ctx}/admin/app-config/careful-delete', id, '请输入您的管理密码以确定删除此型号');
		}
	</script>

	</body>
</html>
